package com.it.schoolbookshop_back.enums;

public enum UserRoleEnums {
    STUDENT(0),
    ADMIN(1);
    
    private final int code;

    UserRoleEnums(int code) {
        this.code = code;
    }

    public int getCode() {
        return code;
    }

    public static UserRoleEnums getByCode(int code) {
        for (UserRoleEnums role : UserRoleEnums.values()) {
            if (role.getCode() == code) {
                return role;
            }
        }
        return null;
    }
}
